/**
* @file ExplosionReverbFilter.cpp
* @author Max Ocklind
* @version 2010-01-11
*
* A simple reverb sound effect filter intended to somewhat mimic the effects on hearing after being
* subjected to the pressure wave of a larger explosion.
**/


/* includes */

#include "ExplosionReverbFilter.h"


/* functions */

/**
* Filters the specified OpenAL sound source.
*
* @param source the OpenAL sound source to be filtered
*/
void ExplosionReverbFilter::mFilter(SoundSource source)
{
	// set source properties
	alSourcef(source, AL_GAIN,  0.25f * mSourceProperties[source].gain);
	errCheck->checkALError("ExplosionReverbFilter", "mFilter (gain)");
	alSourcef(source, AL_PITCH, 0.75f * mSourceProperties[source].pitch);
	errCheck->checkALError("ExplosionReverbFilter", "mFilter (pitch)");

	// attach the first auxiliary source send to the first effect slot without filtering
	alSource3i(source, AL_AUXILIARY_SEND_FILTER, mEffectSlots[0], 0, NULL);
	errCheck->checkALError("ExplosionReverbFilter", "mFilter (attach aux source send)");
}